<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>jsApi支付测试</title>
</head>
<body>

<script>

    function onBridgeReady() {
        WeixinJSBridge.invoke('getBrandWCPayRequest', {
                "package": "prepay_id=wx242324248651570909d17e13d84a8a0000",
                "nonceStr": "1637767471392",
                "timeStamp": "1637767471",
                "paySign": "alB7+3Js8RJ22Rp74kshLo3hdhBYL7CLepvPj9jGMwH9ucho8AfFhd5pJ3u49IBLOOdT4fFEyLVKwa9/Ui/V4UCANyk+jwZj576Qu6Bb3KOhGj+57GtZcPduORNLpDVXU6aS5sTSUmFOhbgdCQ09/zAkDuZ8MVlITpKrO0wWMlv/qP5AZHu3kvLPAKMnOT63UMtk4iya7n3XYfSEo0rJBWc3PogsEY6QYwTjXBuuiTARpGomA8xGwSxkzV9xjQcxnZyZaqSo2bAO9oZvkbFqvq70UXrVWntONNhQ4iXQcvpdjZwiZl4MyJC5+ic0MlFdRq/IPsKiQ1IFaAxdf4qyYQ==",
                "appId": "wx47eedb8861a9a4ae",
                "signType": "RSA"
            },
            function(res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    // 使用以上方式判断前端返回,微信团队郑重提示：
                    //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                }
            });
    }
    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }

</script>
</body>
</html>